<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    //数组操作   ：   增删改查
    //改
    let arr = [1, 2, 3, 4]
    arr[1] = 666
    //增(末尾).push
    arr.push(33, 44, 55)
    //增（前面）.unshift
    arr.unshift(100, 221)
    console.log(arr);
    //小作业说是
    let newArr = [];
    let arr1 = [2, 0, 1, 77, 0, 52, 0, 25, 7]
    for (let i = 1; i < arr1.length; i++) {
      if (arr1[i] > 10 && arr[i] !== 0) {
        newArr.push(arr1[i]);
      }
    }
    console.log(newArr);
    //删 (后)
    arr.shift
    //删（前）pop
    arr.pop
    //splice 删除方法 arr.splice (起始位置，删除个数，增加新数据)
    arr.splice(0, 2, 504)
    console.log(arr);


  </script>
</body>

</html>